export function formatSensorType(that, type) {
	switch (type) {
		case 0:
			return that.$t('fromTheMachine')
		case 1:
			return that.$t('sensor')
		case 2:
			return that.$t('host')
		default:
			return that.$t('unKnow')
	}
}

export function listSensorType(that) {
	return [{
			value: 0,
			label: that.$t('fromTheMachine')
		},
		{
			value: 1,
			label: that.$t('sensor')
		},
		{
			value: 2,
			label: that.$t('host')
		}
	]
}


export function listDeviceWarnStatus(that) {
	return [{
			value: 0,
			label: that.$t('untreated')
		},
		{
			value: 1,
			label: that.$t('misinformation')
		},
		{
			value: 2,
			label: that.$t('processed')
		}
	]
}

export function formatDeviceWarnStatus(that, status) {
	for (const item of listDeviceWarnStatus(that)) {
		if (item.value === status) {
			return item.label
		}
	}
	return that.$t('unKnow')
}

export function formatLanguage(that, language) {
	switch (language) {
		case 'zh':
			return that.$t('zh')
		case 'en':
			return that.$t('en')
		case 'pt':
			return that.$t('pt')
		default:
			return that.$t('unKnow')
	}
}

export function listLanguage(that) {
	return [{
			value: 'zh',
			label: that.$t('zh')
		},
		{
			value: 'en',
			label: that.$t('en')
		},
		{
			value: 'pt',
			label: that.$t('pt')
		}
	]
}


export function listTheme(that, language) {
	switch (language) {
		case 'zh':
			return [{
					value: 'orange',
					label: '活力橙'
				},
				{
					value: 'blue',
					label: '天空蓝'
				},
				{
					value: 'pink',
					label: '魅力粉'
				},
				{
					value: 'red',
					label: '热情红'
				},
				{
					value: 'green',
					label: '森林绿'
				}
			]
		default:
			return [{
					value: 'orange',
					label: that.$t('orange')
				},
				{
					value: 'blue',
					label: that.$t('blue')
				},
				{
					value: 'pink',
					label: that.$t('pink')
				},
				{
					value: 'red',
					label: that.$t('red')
				},
				{
					value: 'green',
					label: that.$t('green')
				}
			]
	}
}


export function listTime(that) {
	return [{
			value: 60,
			label: 1 + that.$t('minute')
		},
		{
			value: 60 * 5,
			label: 5 + that.$t('minute')
		},
		{
			value: 60 * 10,
			label: 10 + that.$t('minute')
		},
		{
			value: 60 * 30,
			label: 30 + that.$t('minute')
		},
		{
			value: 60 * 60,
			label: 1 + that.$t('hour')
		},
		{
			value: 60 * 60 * 5,
			label: 5 + that.$t('hour')
		},
		{
			value: 60 * 60 * 10,
			label: 10 + that.$t('hour')
		},
		{
			value: 60 * 60 * 15,
			label: 15 + that.$t('hour')
		},
		{
			value: 60 * 60 * 20,
			label: 20 + that.$t('hour')
		}
	]

}
